{{ header }} {{ column_left }} 
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <div class="pull-right">
        <button type="submit" form="form-kefu" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button>
        <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
      <h1>{{ heading_title }}</h1>
      <ul class="breadcrumb">
        {% for breadcrumb in breadcrumbs %} 
        <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
        {% endfor %} 
      </ul>
    </div>
  </div>
  <div class="container-fluid">
    {% if error_warning %} 
    <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ error_warning }} 
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
    {% endif %} 
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_edit }}</h3>
      </div>
      <div class="panel-body">
        <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-kefu" class="form-horizontal">
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-name">{{ entry_name }}</label>
            <div class="col-sm-10">
              <input type="text" name="name" value="{{ name }}" placeholder="{{ entry_name }}" id="input-name" class="form-control" />
              {% if error_name %} 
              <div class="text-danger">{{ error_name }}</div>
              {% endif %} 
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-status">{{ entry_status }}</label>
            <div class="col-sm-10">
              <select name="status" id="input-status" class="form-control">
                {% if status %} 
                <option value="1" selected="selected">{{ text_enabled }}</option>
                <option value="0">{{ text_disabled }}</option>
                {% else %}   
                <option value="1">{{ text_enabled }}</option>
                <option value="0" selected="selected">{{ text_disabled }}</option>
                {% endif %} 
              </select>
            </div>
          </div>          
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-telephone">{{ entry_telephone }}</label>
            <div class="col-sm-10">
              <input type="text" name="telephone" value="{{ telephone }}" placeholder="{{ entry_telephone }}" id="input-telephone" class="form-control" />
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-image-title">{{ entry_weixin_image_title }}</label>
            <div class="col-sm-10">
              <input type="text" name="image_title" value="{{ image_title }}" placeholder="{{ entry_weixin_image_title }}" id="input-image-title" class="form-control" />
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label">{{ entry_weixin_image }}</label>
            <div class="col-sm-10"><a href="" id="thumb-image" data-toggle="image" class="img-thumbnail"><img src="{{ thumb }}" alt="" title="" data-placeholder="{{ placeholder }}" /></a>
              <input type="hidden" name="image" value="{{ image }}" id="input-image" />
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-2 control-label" for="input-qq">{{ entry_qq }}</label>
            <div class="col-sm-10">
              <div class="table-responsive">
                <table id="qq" class="table table-striped table-bordered table-hover">
                  <thead>
                    <tr>
                      <td class="text-left">{{ entry_qq_number }}</td>
                      <td class="text-left">{{ entry_qq_name }}</td>
                      <td class="text-left">{{ entry_sort_order }}</td>
                      <td></td>
                    </tr>
                  </thead>
                  <tbody>
                    {% set qq_row = 0 %} 
                    {% for service_qq in service_qqs %} 
                    <tr id="qq-row{{ qq_row }}">
                      <td class="text-left"><input type="text" name="service_qq[{{ qq_row }}][qq_number]" value="{{ service_qq.qq_number }}" placeholder="{{ entry_qq_number }}" class="form-control" /></td>
                      <td class="text-left"><input type="text" name="service_qq[{{ qq_row }}][qq_name]" value="{{ service_qq.qq_name }}" placeholder="{{ entry_qq_name }}" class="form-control" /></td>
                      <td class="text-left"><input type="text" name="service_qq[{{ qq_row }}][sort_order]" value="{{ service_qq.sort_order }}" placeholder="{{ entry_sort_order }}" class="form-control" /></td>
                      
                      <td class="text-left"><button type="button" onclick="$('#qq-row{{ qq_row }}').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>
                    </tr>
                    {% set qq_row = qq_row + 1 %} 
                    {% endfor %} 
                  </tbody>
                  <tfoot>
                    <tr>
                      <td colspan="5"></td>
                      <td class="text-left"><button type="button" onclick="addQQ();" data-toggle="tooltip" title="{{ button_qq_add }}" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td>
                    </tr>
                  </tfoot>
                </table>
              </div>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>
  <script type="text/javascript"><!--
var qq_row = {{ qq_row }};

function addQQ() {
	html  = '<tr id="qq-row' + qq_row + '">';
    html += '  <td class="text-right"><input type="text" name="service_qq[' + qq_row + '][qq_number]" value="" placeholder="{{ entry_qq_number }}" class="form-control" /></td>';
	html += '  <td class="text-right"><input type="text" name="service_qq[' + qq_row + '][qq_name]" value="" placeholder="{{ entry_qq_name }}" class="form-control" /></td>';
	html += '  <td class="text-right"><input type="text" name="service_qq[' + qq_row + '][sort_order]" value="" placeholder="{{ entry_sort_order }}" class="form-control" /></td>';
	html += '  <td class="text-left"><button type="button" onclick="$(\'#qq-row' + qq_row + '\').remove();" data-toggle="tooltip" title="{{ button_remove }}" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>';
	html += '</tr>';

	$('#qq tbody').append(html);

	$('.date').datetimepicker({
		pickTime: false
	});

	qq_row++;
}
//--></script>
{{ footer }} 
